package com.tech.pattern.template.eg;

public class HummerH1Model extends HummerModel {
    // 默认喇叭响
    private boolean alarmFlag = true;
    

    @Override
    protected void start() {
        System.out.println("HummerH1Model start...");
    }

    @Override
    protected void stop() {
        System.out.println("HummerH1Model stop...");
        
    }

    @Override
    protected void alarm() {
        System.out.println("HummerH1Model alarm...");
    }

    @Override
    protected void engineBoom() {
        System.out.println("HummerH1Model engineBoom...");
    }

    // 钩子方法，默认喇叭是会响的
    @Override
    protected boolean isAlarm() {
        return this.alarmFlag;
    }
    
    // 默认是要喇叭响，但是客户端可以具体操控
    public void setAlarm(boolean alarmFlag){
        this.alarmFlag = alarmFlag;
    }
}
